/*
 * Matthew Cramer, Jesse Martinez, Marc Mendoza 
 * CSE 325 Lab 5
 * File: LRU.c
 * Description: The LRU simulates hardware for the LRU counter
 *
 */
#include "../QueueManager/QueueManager.h"
#include "../MemoryManager/MemoryManager.h"
#include "LRU.h"
int find(memory_block*);

int find(memory_block* queue)
{
	int index=0;
	int temp=1000000000;
	int x;
	int k=0;
	for(x=0; x<256; x++)
	{
			if(queue[x].frameType == 1)//if a pagetable ignore because does not go into backing storage
			{
			}
			else
			{
				    if(temp > queue[x].LRU)
					{
						
						temp = queue[x].LRU;
						index = x;
					}
				
			}
				
	}
	return index;//returns LRU to Memory Manager
}